-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(#major); kwenta; new subgraph #2297
Conversation
7638607
to
0bbf772
Compare
this version with tvl passed QA |
0bbf772
to
0974dd1
Compare
0974dd1
to
f5c654c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amritkumarj a few notes before a deeper PR:
- I notice there are a lot of files/functions that are unused. These should be removed to simplify the code and make the review smaller
- The SDK should cover a lot of the code
- My comments are a starting place, I do see some more things that are unused
- Can you add the deployment link to the header comment in the PR
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @dmelotik mentioned, you don't really need most files in src/common
and src/utils
since these are included in the sdk
80e78cc
to
e820bd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, please fix lint errors 😃
subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json
Outdated
Show resolved
Hide resolved
Hey @dhruv-chauhan I think there is some confusion between working of kwenta and gmx In gmx the collateral is deposited when we are opening the position, and when we close the position we receive the collateral back in our account But this is not the case with kwenta - we first deposit collateral i.e. sUSD for all markets and then we open any position, and on close just the collateral value is increased, which can be withdrawn by the user in a different transaction And there are no liquidity pools in Kwenta like GMX So, I think instead of "deposit()" and "withdraw()" in "handleMarginTransferred" we should use collateral in and out, and not use these functions in "handlePositionModified" And "deposit()" & "withdraw()" function should be removed as they are for liquidity pools What do you think? |
If I understand correctly,
So imo, @ishraq8 can overrule |
2003cfd
to
db861e2
Compare
This makes sense. sUSD becomes the collateral instead of other input tokens. |
aa7a130
to
23a07eb
Compare
Yes, sUSD is used as collateral but what I wanted to say is there is no withdrawal or deposit of collateral at time of But I think what @dhruv-chauhan said makes sense and fixed the issues according to his solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the code looks good. 🤙
Some of the data looks a little odd to me, but I'll leave verification for QA. Example,
- (derivPerpProtocols) longPositionCount ~ 19k vs shortPositionCount ~ 200
- (derivPerpProtocols) cumulativeInflowVolume ~ 4.7b vs cumulativeOutflowVolume ~ 470m
** Needs to be fixed,
- (usageMetricsDailySnapshots) dailyActiveLiquidators > cumulativeUniqueLiquidators query
cc @ishraq8
subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json
Show resolved
Hide resolved
Data looks good and passed QA. looks like the Cumulative inflow will always be greater than outflow as the protocol relies on higher inflow. if it is reveresed it indicates there is a bankrun or unhealthy protocol (kwenta is quite healthy). |
Hey @amritkumarj, if you could just fix |
Fixed it in the new commit This issue is also present in gmx - query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thank you!
Deployment link : https://thegraph.com/hosted-service/subgraph/amritkumarj/kwenta-optimism